//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package objects;

import java.util.Collection;
import java.util.LinkedHashMap;

public class FruitTrees {
    private static final LinkedHashMap<Integer, FruitTreeEntry> treesById = new LinkedHashMap();
    private static final LinkedHashMap<String, FruitTreeEntry> treesByName = new LinkedHashMap();
    private static final LinkedHashMap<String, FruitTreeEntry> treesByFruit = new LinkedHashMap();

    public FruitTrees() {
    }

    public static void createFruitTreeEntry(String Name, String Tool, Integer Price) {
        FruitEntry e = Fruits.getByTree(Name);
        FruitTreeEntry fe = new FruitTreeEntry(Name, Tool, Price, Integer.valueOf(treesById.size()), e != null?e.getName():null);
        treesById.put(fe.getGlobalID(), fe);
        treesByName.put(fe.getName(), fe);
        treesByFruit.put(fe.getFruit(), fe);
    }

    public static FruitTreeEntry getById(Integer id) {
        return (FruitTreeEntry)treesById.get(id);
    }

    public static FruitTreeEntry getByName(String name) {
        return (FruitTreeEntry)treesByName.get(name);
    }

    public static FruitTreeEntry getByFruit(String feed) {
        return (FruitTreeEntry)treesByFruit.get(feed);
    }

    public static void clear() {
        treesById.clear();
        treesByName.clear();
        treesByFruit.clear();
    }

    public static Collection<FruitTreeEntry> get() {
        return treesById.values();
    }

    public static void treeAddStage(String name, Integer time, Integer fruitCount) {
        FruitTreeEntry fe = (FruitTreeEntry)treesByName.get(name);
        if(fe != null) {
            fe.addStage(time, fruitCount);
        }

    }
}
